import request from '~/utils/resquest'

// 获取回路开关分组列表
export const getMonitorLoopSwitchGroupList = <T>(params: T) =>
  request({
    url: '/api/gxsaas-monitor/task/taskgroup/getTaskGroupBoxList',
    method: 'get',
    params
  })

// 新增回路开关分组
export const addMonitorLoopSwitchGroupInfo = <T>(params: T) =>
  request({
    url: '/api/gxsaas-monitor/task/taskgroup/v1_4/addGroup',
    method: 'post',
    data: params
  })

// 修改回路开关分组
export const updateMonitorLoopSwitchGroupInfo = <T>(params: T) =>
  request({
    url: '/api/gxsaas-monitor/task/taskgroup/update',
    method: 'post',
    data: params
  })

// 删除回路开关分组
export const deleteMonitorLoopSwitchGroupInfo = <T>(params: T) =>
  request({
    url: '/api/gxsaas-monitor/task/taskgroup/remove',
    method: 'post',
    params
  })

// 应用
export const groupLoopApplyListPost = <T>(params: T) =>
  request({
    url: '/api/gxsaas-monitor/task/groupLoop/applyList',
    method: 'post',
    params
  })

// 删除
export const groupLoopRemoveApplyPost = <T>(params: T) =>
  request({
    url: '/api/gxsaas-monitor/task/groupLoop/removeApply',
    method: 'post',
    params
  })

// 回路tree
export const getDeviceLoopTreeGet = <T>(params: T) =>
  request({
    url: '/api/gxsaas-monitor/hardware/getDeviceLoopTree',
    method: 'get',
    params
  })

// 添加回路
export const saveTaskGroupDeviceLoopPost = <T>(data: T) =>
  request({
    url: '/api/gxsaas-monitor/task/groupLoop/saveTaskGroupDeviceLoop',
    method: 'post',
    data
  })

// 获取回路分组列表
export const getMonitorGroupLoopList = <T>(params: T) =>
  request({
    url: '/api/gxsaas-monitor/task/groupLoop/list',
    method: 'get',
    params
  })

// 获取设备型号
export const getModelByDeviceIdGet = <T>(params: T & { id?: string }) =>
  request({
    url: `/api/gxsaas-monitor/deviceModel/getModelByDeviceId/${params.id}`,
    method: 'get'
  })

// 获取监控箱所有任务组
export const getTaskGroupHardwareList = () =>
  request({
    url: '/api/gxsaas-monitor/task/taskgroup/v1_4/getTaskGroupHardwareList',
    method: 'get'
  })

// 获取监控箱无任务组
export const getNoTaskGroupHardwareList = () =>
  request({
    url: '/api/gxsaas-monitor/task/taskgroup/v1_4/getNoTaskGroupHardwareList',
    method: 'get'
  })

// 查询监控箱任务组详情集合(是否分配任务)
export const getUseTaskGroupHardwareList = () =>
  request({
    url: '/api/gxsaas-monitor/task/taskgroup/v1_4/getUseTaskGroupHardwareList',
    method: 'get'
  })

// 回路变更分组
export const changeLoopGroupByLoopIds = <T>(params: T) =>
  request({
    url: '/api/gxsaas-monitor/task/taskgroup/v1_4/moveGroup',
    method: 'post',
    params
  })

// 获取分组回路任务历史
export const getGroupLoopLogList = <T>(params: T) =>
  request({
    url: '/api/gxsaas-monitor/task/taskgroup/v1_4/groupLoopLogList',
    method: 'get',
    params
  })
